<template>
  <div id="centerRight1">
    <div class="bg-color-black">
      <div class="d-flex pt-2 pl-2">
        <span>
          <icon name="chart-line" class="text-icon"></icon>
        </span>
        <div class="d-flex">
          <span class="fs-xl text mx-2">最新岗位数据</span>
        </div>
      </div>
      <div class="d-flex jc-center body-box">
        <dv-scroll-board ref="dvScolBoard" class="dv-scr-board" :config="config" />
      </div>
    </div>
  </div>
</template>

<script>

import axios from "axios";
export default {
  data() {
    return {
      config: {
        header: ['岗位名称', '招聘企业'],
        data: [],
        //表格行数
        rowNum: 5,
        headerHeight: 35,
        //表头
        headerBGC: '#17212c',
        //奇数行
        oddRowBGC: '#463d3d',
        //偶数行
        evenRowBGC: '#1d1f31',
        index: true,
        columnWidth: [50],
        align: ['center']
      }
    }
  },

  created() {

  },

  mounted() {
    this.getPostList()
  },

  methods:{
    getPostList() {
      axios.post('api/data/postList').then(res => {
        console.log(res)
        if (res.data.code == '200') {
          console.log()
          let dataArr = []
          for (let i = 0; i < res.data.data.length; i++) {
            let item = res.data.data[i]
            let s = [item.TITLE,"<span  class='colorGrass'>"+ item.COMPANY +"</span>"]
            dataArr.push(s)
          }
          this.config.data = dataArr
          this.$refs.dvScolBoard.autoResizeMixinInit();
        }
      }).catch(err => {
        console.log(err);
      })
    }
  }
}
</script>

<style lang="scss" scoped>
$box-height: 300px;
$box-width: 500px;
#centerRight1 {
  padding: 16px;
  padding-top: 20px;
  height: $box-height;
  width: $box-width;
  border-radius: 5px;
  .bg-color-black {
    height: $box-height - 30px;
    border-radius: 10px;
  }
  .text {
    color: #c3cbde;
  }
  .body-box {
    border-radius: 10px;
    overflow: hidden;
    .dv-scr-board {
      width: 500px;
      height: 280px;
    }
  }
}
</style>
